/* eslint-disable */
<template>
	<!--绑定资源主数据-->
	<el-dialog class="appendDataResource" :title="$t('components.appendDatasource.title')"  :visible.sync="show"   :close-on-click-modal="false"  @close="closeDialog">
		<el-row>
			<el-col :span="24">
			  	<el-form   :inline="false" :model="dataGroupRow" ref="dataGroupRow"  label-width="110px">
			  		<el-col :span="24">
			  			<el-col :span="9">
							<el-form-item :label="$t('common.resourceName')+'：'" >
								<el-input  readonly v-model="dataGroupRow.resourceName" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="9">
							<el-form-item :label="$t('common.dataGroupName')+'：'">
								<el-input  readonly v-model="dataGroupRow.dataGroupName" :placeholder="$t('common.inputPlaceholder')"></el-input>
							</el-form-item>
						</el-col>
			  		</el-col>
					<el-col :span="9">
			  			<el-form-item :label="$t('common.code')+':'"  prop="nodeCode">
							<el-input clearable  v-model="dataGroupRow.nodeCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
			  		</el-col>
			  		<el-col :span="9">
			  			<el-form-item :label="$t('common.name')+':'" prop="nodeName">
							<el-input clearable  v-model="dataGroupRow.nodeName" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
			  		</el-col>
			  		<el-col :span="9">
			  			<el-form-item :label="$t('common.parentCode')+':'" prop="parentCode">
							<el-input clearable  v-model="dataGroupRow.parentCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
			  		</el-col>
			  		<el-col :span="9" v-if="dataGroupRow.paramType==5">
						<el-form-item :label="$t('common.isusable')+':'" >
							<el-select  v-model="dataGroupRow.isusable" :placeholder="$t('common.selectPlaceholder')" >
								<el-option  v-for="(item,index) in isusableOptions" :key="index" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
			    	</el-col>
			    	<el-col :span="9" v-if="dataGroupRow.paramType==6 ||dataGroupRow.paramType==11">
						<el-form-item :label="$t('common.netCode')+':'" prop="netCode" >
							<el-input clearable  v-model="dataGroupRow.netCode" :placeholder="$t('common.inputPlaceholder')"></el-input>
						</el-form-item>
				    </el-col>
			  		 <el-col :span="6" >
				    	<el-button style="margin-left: 20px;" type="primary" @click="onSearch" >{{$t('common.searchBtn')}}</el-button>
				    </el-col>
				</el-form> 
			</el-col>
			    <el-col :span="24" v-if="show">
				    <el-row  v-if="paramStruct==1">
						<el-col v-if="treeType" class="border-box left" :span="12">
				 			<div >
						 		<el-tree :render-content="renderContent" :default-expanded-keys="defaultExpandedKeys"  v-loading="loadind1" :load="loadNode" node-key="code"   @check-change="handleCheckChange" ref="resourceTree" lazy show-checkbox  :props="defaultProps" ></el-tree>
						 	</div>
				 		</el-col>
				 		<el-col v-else class="border-box left" :span="12">
			 				<el-table  stripe height="399" ref="resourceTable" v-loading="loadind1" :data="tableData" style="width: 100%"  @selection-change="selectChange1">
						      <el-table-column type="selection"  width="45"></el-table-column>
						      <el-table-column prop="code" align="left" :label="$t('common.code')" width="62"  show-overflow-tooltip></el-table-column>
						      <el-table-column prop="name" align="left" :label="$t('common.name')" show-overflow-tooltip> </el-table-column>
						      <el-table-column prop="parentCode" align="left" :label="$t('common.parentCode')" show-overflow-tooltip> </el-table-column>
						    </el-table>
						    <div class="tablebottom">
						    	<el-pagination  
								      @size-change="pageSizeChange1"
								      @current-change="handleCurrentChangePage1"
								      :current-page="pagination1.pageNum"
								      :page-sizes="[10,100, 500, 1000]"
								      :page-size="pagination1.pageSize"
								      :pager-count="5"
								      layout="->,prev, pager, next,sizes, total"
								      :total="pagination1.totalSize">
								</el-pagination>
						    </div>
				 		</el-col>
					 	<el-col class="border-box right" :span="12"  >
			 				<div class="tips">已选&nbsp;&nbsp;&nbsp;({{selectedDataTemp.length}})</div>
			 				<div class="tagList">
			 					<div class="tagItem flex flex-vc" :key="item.code" v-for="item in selectedDataTemp"  closable :disable-transitions="false">
			 						<span class="code treeCode">{{item.code}}</span>
			 						<span class="text" :title="item.code+'/'+item.name">{{item.name}}</span>
										 <i @click="handleCloseTreeNode(item)" class="el-tag__close el-icon-circle-close"></i>
			 					</div>
			 				</div>
				 		</el-col>	
				 	</el-row>
				 	<el-row  v-if="paramStruct==0" >
				 		<el-col class="border-box left" :span="12">
			 				<el-table  stripe height="399" ref="resourceTable" v-loading="loadind1" :data="tableData" style="width: 100%"  @selection-change="selectChange1">
						      <el-table-column type="selection"  width="45"></el-table-column>
						      <el-table-column prop="code" align="left" :label="$t('common.code')" width="62"  show-overflow-tooltip></el-table-column>
						      <el-table-column prop="name" align="left" :label="$t('common.name')" show-overflow-tooltip> </el-table-column>
						      <el-table-column prop="parentCode" align="left" :label="$t('common.parentCode')" show-overflow-tooltip> </el-table-column>
						    </el-table>
						    <div class="tablebottom">
						    	<el-pagination  
								      @size-change="pageSizeChange1"
								      @current-change="handleCurrentChangePage1"
								      :current-page="pagination1.pageNum"
								      :page-sizes="[10,20, 50, 100, 200]"
								      :page-size="pagination1.pageSize"
								      :pager-count="5"
								      layout="->,prev, pager, next, sizes,total"
								      :total="pagination1.totalSize">
								</el-pagination>
						    </div>
				 		</el-col>
				 		<el-col class="border-box right" :span="12"  >
			 				<div class="tips">已选&nbsp;&nbsp;&nbsp;({{selectedDataTemp.length}})</div>
			 				<div class="tagList">
			 					<div class="tagItem flex flex-vc" :key="item.code" v-for="item in selectedDataTemp"  closable :disable-transitions="false">
			 						<span class="code">{{item.code}}</span>
			 						<span class="text" :title="item.code+'/'+item.name">{{item.name}}</span>
										 <i @click="handleClose(item)" class="el-tag__close el-icon-circle-close"></i>
			 					</div>
			 				</div>
				 		</el-col>
				 	</el-row>
			    </el-col>
			</el-row> 
		<div slot="footer" class="dialog-footer">
			<el-button @click="closeDialog">{{$t('common.giveUp')}}</el-button>
			<el-button type="primary" @click="saveResourceChecked">{{$t('common.save')}}</el-button>
		</div>
	</el-dialog>
</template>

<script>
import {
    Message, Notification, MessageBox, Loading
} from 'element-ui'
export default {
    name: 'appendDatasource',
    props: [
        'visible', 'mainRow'
    ],
    data () {
        return {
            show: false,
            dataGroupRow: {},
            defaultProps: {
		        	children: 'children',
		            label: 'name'
		        },
		        paramTypeDic:[
				{value:0,label:this.$t('modules.resourceManage.thirdParty'),paramStruct:'0'},
				{value:1,label:this.$t('modules.resourceManage.netAsrua'),paramStruct:'1'},
				{value:2,label:this.$t('modules.resourceManage.warehouse'),paramStruct:'0'},
				{value:3,label:this.$t('modules.resourceManage.shipper'),paramStruct:'0'},
				{value:4,label:this.$t('modules.resourceManage.monthlyCustomer'),paramStruct:'0'},
				{value:5,label:this.$t('modules.resourceManage.companyAccount'),paramStruct:'0'},
				{value:6,label:this.$t('modules.resourceManage.orgSap'),paramStruct:'1'},
				{value:7,label:this.$t('modules.resourceManage.supplier'),paramStruct:'0'},
				{value:8,label:this.$t('modules.resourceManage.industryCode'),paramStruct:'0'},
				{value:9,label:this.$t('modules.resourceManage.empCodeSasp'),paramStruct:'0'},
				{value:10,label:this.$t('modules.resourceManage.localSQl'),paramStruct:'0'},
				{value:11,label:this.$t('modules.resourceManage.close_typeCompany'),paramStruct:'1'},
				],
		        defaultCheckedKeys: [],
		       	currentCheckedNodes: [],
		       	checkUpdateNodes: [],
		       	currentCheckedKeys: [],
		       	defaultExpandedKeys: [],
		        tableData: [],
		        pagination1: {
                totalSize: 0,
                pageSize: 10,
                pageNum: 1,
                totalPage: 0
            },
		       	loadind1: false,
		       	multipleSelection1: [],
				chooseSelectionArr1:[],
				perportyArr:[],
				selectTagArr:[],
				paramStruct:'',
				list:[],
				selectedData:[],
				selectedDataTemp:[],
				currentPageFlag:false,
				treeType:true,
				isusableOptions:[{value:0,label:'无效'},{value:1,label:'有效'},{value:'',label:'全部'}],
        }
    },
    watch: {
        visible: 'visibleChange'
    },
    mounted () {

    },
    methods: {
        visibleChange (val) {
            this.show = val
            if (val) {
				this.treeType=true
				this.mainRow.nodeCode=''
				this.mainRow.nodeName=''
				this.mainRow.parentCode = ''
				this.mainRow.isusable = 1
				this.mainRow.netCode = ''
                this.dataGroupRow = this.$deepCopy(this.mainRow)
		    	this.multipleSelection1 = []// 清空当前页面勾选项
                this.chooseSelectionArr1 = []// 清空页面所有勾选项
                this.defaultCheckedKeys = []
                this.currentCheckedKeys = [] // 当前选中的key节点
                this.checkUpdateNodes = []
                this.pagination1.pageNum = 1
		    	//获取资源表的属性选项参数
		    	this.perportyArr=['id','code','parentCode','name','level']
			    this.selectTagArr=this.dataGroupRow.returnParameter?this.dataGroupRow.returnParameter.split(','):[]
			    
			    this.selectedData=[]
				this.selectedDataTemp=[]
				/*清空选项数据*/
				if(this.mainRow.paramStruct == 0){
					this.paramStruct=this.mainRow.paramStruct
					this.searchSelectedList()
				}else{
					this.searchSelectedList()
				   
				}
			}
		},
		closeDialog(){
			this.$refs['dataGroupRow'].resetFields();//重置表单
			if(this.paramStruct==1 && this.treeType){
				this.$refs.resourceTree.setCheckedKeys([])
			}
			this.$emit('close')
		},
	    renderContent(h, { node, data, store }) {
	    	if(node.label=='test'){
	    		return (
			          <span class="custom-test-node current-test-node">
			            <span>{node.label+'/'+data.code}</span>
			          </span>);
	    	}else{
	    		return (
			          <span class="custom-tree-node">
			            <span>{node.label+'/'+data.code}</span>
			          </span>);
	    	}
	    },
		handleCheckChange(node,data){//勾选模块节点change
	    	//如果这个节点是父节点，并且是data=true,即加入右边，先判断这个node在右边已选列表有没有子节点如果有，把子节点都去掉
			if(data){
				let i,t
				for(i=0;i<this.selectedData.length;i++){
	    			if(this.selectedData[i].parentCode == node.code){
	    				this.selectedData.splice(i,1)
	    				i--
	    			}
	    		}
	    		for(t=0;t<this.selectedDataTemp.length;t++){
	    			if(this.selectedDataTemp[t].parentCode == node.code){
	    				this.selectedDataTemp.splice(t,1)
	    				t--
	    			}
	    		}
			}else{//父节点的取消操作
				//两种取消情况：1、手动取消父节点，所有父节点和子节点都要移除；2、全选情况下取消某个子节点导致触发的父节点的取消，那么只能剔除父节点，而且要把子节点加到右边
				//1、手动取消父节点，所有父节点和子节点都要移除 ，那么不需要做特殊处理，正常取消剔除即可
				//2、全选情况下取消某个子节点导致触发的父节点的取消，此时先触发父节点取消勾选动作，先把子节点都加到右边
				var newCheckedNodes = this.$refs.resourceTree.getCheckedNodes();
				var temp = 0
				let i,c
				for(i=0;i<this.selectedData.length;i++){
	    			if(this.selectedData[i].code == node.code){  //当前父节点在右边才是真正取消操作
	    				temp =1
	    			}
	    		}
				if(temp == 1){
					for(c=0;c<newCheckedNodes.length;c++){
						if(newCheckedNodes[c].parentCode == node.code && newCheckedNodes[c].code != '-1'){
							this.selectedData.push(newCheckedNodes[c])
							this.selectedDataTemp.push(newCheckedNodes[c])
						}
					}
				}
					
			}
    		//判断这个子节点的父节点在不在右边，在右边的话，此次勾选是加入右边的勾选，不用加入到右边直接结束
    		let tempFlag=0;
    		let i
    		for(i=0;i<this.selectedData.length;i++){
    			if(this.selectedData[i].code == node.parentCode){
    				tempFlag = 1
    				break
    			}
    		}
    		if(tempFlag==1 && data){  //第一种父节点在右边了子节点加入的时候不做操作
    			return
    		} 
	    	this.currentCheckedNodes=this.$refs.resourceTree.getCheckedNodes();
	    	this.currentCheckedKeys=[]
	    	for(i=0;i<this.currentCheckedNodes.length;i++){
    			this.currentCheckedKeys.push(this.currentCheckedNodes[i].code)
    		}
	    	if(data){//加入
	    		//加入总的已选数组
	    		var flag=0
	    		for(var t=0;t<this.selectedData.length;t++){
	    			if(this.selectedData[t].code == node.code){
	    				flag =1
	    			}
	    		}
	    		if(flag == 0){
	    			//把已勾选的加到右边
					this.selectedData.push(node)
	    		}
	    		//加入页面可见部分的已选数组
		    	flag=0
	    		for(var m=0;m<this.selectedDataTemp.length;m++){
	    			if(this.selectedDataTemp[m].code == node.code){
	    				flag =1
	    			}
	    		}
	    		if(flag == 0){
	    			//把已勾选的加到右边
					this.selectedDataTemp.push(node)
	    		}	
		    	
	    	}else{//取消勾选
	    		for(let i=0;i<this.selectedData.length;i++){
	    			if(this.selectedData[i].code == node.code){
	    				this.selectedData.splice(i,1)
	    				break
	    			}
	    		}
	    		for(let t=0;t<this.selectedDataTemp.length;t++){
	    			if(this.selectedDataTemp[t].code == node.code){
	    				this.selectedDataTemp.splice(t,1)
	    				break
	    			}
	    		}
	    	}
	    },
	    loadNode(node, resolve) {  //加载树形资源主数据
			var param={
				dataGroupId:this.dataGroupRow.dataGroupId,
				resourceId:this.dataGroupRow.resourceId ,
				code:node.data?node.data.code:0,
				paramUrl:this.dataGroupRow.paramUrl || '',
			}
			this.currentPageFlag=true
			var urlH="/dev-basp-system/resource/selectParams"
	        this.loadind1=true;
			var that=this;
			this.$httpExt().post(urlH, param)
			.then((response) => {
				that.loadind1=false;
				var body = response.result.paramsList
				if(body.length==0){
					this.currentPageFlag=false
					return resolve(body);
				}
				if(node.level==0){
					that.defaultExpandedKeys=response.result.parent
				}
				that.defaultCheckedKeys=that.$deepCopy(that.currentCheckedKeys,[]);
				//判断当前展开层级的父节点是否在右边已经被选
				var checkAll=false
				for(var r=0;r<that.selectedData.length;r++){ 
					if(body[0].parentCode==that.selectedData[r].code){//勾选上
						checkAll=true
						break;
					}
				}
				if(checkAll){//父节点被全选，则需要从右侧移除
					for(var i=0;i<body.length;i++){// 检查右侧是否已经有过这个数据
						body[i].status=0;
						var flag=false;
						for(var a=0;a<that.selectedData.length;a++){
							if(that.selectedData[a].code==body[i].code){
								that.selectedData.splice(a,1)
								flag=true;  //已经在右边
								break;
							}
						}
						flag=false;
						for(var b=0;b<that.selectedDataTemp.length;b++){
							if(that.selectedDataTemp[b].code==body[i].code){
								that.selectedDataTemp.splice(b,1)
								flag=true;  //已经在右边
								break;
							}
						}
					}
				}else{ //父节点没有被全选，则只用勾选在右侧的
					for(let a=0;a<body.length;a++){  //避免后台传过来的是已勾选，但是其实在页面已经取消勾选了，所以先清空一遍
						body[a].status=0;
					}
					for(let i=0;i<body.length;i++){// 将右边的已勾选赋值到左边的当前查询列表的satus里
						for(let t=0;t<that.selectedData.length;t++){ 
							if(body[i].code==that.selectedData[t].code){//勾选上
								body[i].status=1;
								break;
							}
						}
					}
				}
				for(let i=0;i<body.length;i++){ 
					if(body[i].status==1){//勾选上
						let index=that.defaultCheckedKeys.indexOf(body[i].code)
						if(index<0){
							that.defaultCheckedKeys.push(body[i].code)
						}
					}
				}
				that.$nextTick(() => {
					that.setCheckedKey()
					that.currentPageFlag=false  //先让勾选默认事件执行完
					var eleArr=document.getElementsByClassName('current-test-node')
					for(var i=0;i<eleArr.length;i++){
						eleArr[i].parentNode.parentNode.style.display="none"
						eleArr[i].className="custom-test-node"
					}
				});
				if(body.length){
					var temp={
						code:'-1',
						name:'test',
						level:body[0].level,
						status:0,
						parentCode:body[0].parentCode
					}
					body.push(temp)
				}
				return resolve(body);
				
			}, (response) => {
				this.currentPageFlag=false
				this.loadind1=false;
				Notification.error({
					title: this.$t('common.exception'),
					message: response.msg? response.msg:this.$t('common.exceptionWornText')
				});
			});
	    },
	    setCheckedKey(){
	    	var that=this
			return new Promise((resolve,reject)=>{
				that.$refs.resourceTree.setCheckedKeys(that.defaultCheckedKeys)
				resolve(true)
			})
	    },
	    onSearch(){
	    	this.currentCheckedKeys=[]
	    	this.pagination1.pageNum = 1;
	    	if(this.dataGroupRow.nodeCode || this.dataGroupRow.nodeName || this.dataGroupRow.parentCode || this.dataGroupRow.netCode){
	    		this.treeType=false
	    	}else{
	    		this.treeType=true
	    	}
	    	this.getSelectFilter()
		    	
	    },
	    getSelectFilter(){
			const that=this;
			let arr
			arr = that.selectedData.filter(item => {
				let itemCode = item.code.toLowerCase()
				let nodeCode = this.dataGroupRow.nodeCode.toLowerCase()
				let parentCode = this.dataGroupRow.parentCode.toLowerCase()
				let itemParent =item.parentCode? item.parentCode.toLowerCase():''
                return  itemCode.indexOf(nodeCode)>-1 && item.name.indexOf(this.dataGroupRow.nodeName)>-1 && itemParent.indexOf(parentCode)>-1;
            });
            that.selectedDataTemp = this.$deepCopy(arr,[])
            if(this.paramStruct==1 && !this.dataGroupRow.nodeCode && !this.dataGroupRow.nodeName && !this.dataGroupRow.parentCode && !this.dataGroupRow.netCode){
            	return
            }else{
            	this.searchResourceList()
            }
		},
	    saveResourceChecked(){//提交勾选
	    	const tempSelect=this.selectedData
	    	if(tempSelect.length<1){
			    this.$message({
			          message: '您未选择任何节点',
			          type: 'warning'
			    });
				return 
	    	}
	    	this.$emit('saveResourceChecked',tempSelect,this.selectTagArr)
	    },
	    selectChange1(val){
			if(this.currentPageFlag){  //不是手动勾选的，查列表自动带出来的，就不要清除右边的勾选
				return
			}
			//先从右边把当前页全部剔除，再根据已选项加到右边
			const that=this
			//全量隐藏的不经过过滤的数组
			for(let i=0;i<that.tableData.length;i++){
				for(let k=0;k<that.selectedData.length;k++){
					let id1=that.selectedData[k].code
					let id2=that.tableData[i].code
					if(id1==id2){
						that.selectedData.splice(k,1)
						break;
					}
				}
			}
			//把已勾选的加到右边
			that.selectedData= that.selectedData.concat(val)
			
			//经过过滤的数组的剔除
			for(let i=0;i<that.tableData.length;i++){
				for(let j=0;j<that.selectedDataTemp.length;j++){
					let id1=that.selectedDataTemp[j].code
					let id2=that.tableData[i].code
					if(id1==id2){
						that.selectedDataTemp.splice(j,1)
						break;
					}
				}
			}
			//把已勾选的加到右边
			that.selectedDataTemp= that.selectedDataTemp.concat(val)
			this.multipleSelection1 = val
		},
		handleCloseTreeNode(tag){  //树形的情况下，关闭当前标签
			const that=this
			if(this.treeType){
				//在树的当前勾选数组currentCheckedNodes，如果这个tag存在于当前页面则要手动取消勾选
				this.currentCheckedNodes=this.$refs.resourceTree.getCheckedNodes();
				for(let k=0;k<that.currentCheckedNodes.length;k++){
					if(that.currentCheckedNodes[k].code==tag.code){
						that.currentCheckedNodes.splice(k, 1);
						break;
					}
				}
				for(let i=0;i<that.selectedData.length;i++){
					if(that.selectedData[i].code==tag.code){
						that.selectedData.splice(i, 1);
						break;
					}
				}
				that.selectedDataTemp.splice(that.selectedDataTemp.indexOf(tag), 1);
				that.currentCheckedKeys=[]
		    	for(let i=0;i<that.currentCheckedNodes.length;i++){
	    			that.currentCheckedKeys.push(that.currentCheckedNodes[i].code)
	    		}
				that.$nextTick(() => {
					that.$refs.resourceTree.setCheckedKeys(that.currentCheckedKeys)
				});
			}else{
				this.handleClose(tag)
			}
				
		},
		handleClose(tag){  //关闭当前已选择的标签
			let flag=0;
			const that=this
			let tempSelectCurrent=[]
			//在当前页面遍历，如果这个tag存在于当前页面则要手动取消勾选
			for(let k=0;k<that.multipleSelection1.length;k++){
				if(that.multipleSelection1[k].code==tag.code){
					tempSelectCurrent.push(that.multipleSelection1[k]);
					flag=1
					break;
				}
			}
			for(let i=0;i<this.selectedData.length;i++){
				if(this.selectedData[i].code==tag.code){
					this.selectedData.splice(i, 1);
					break;
				}
			}
			this.selectedDataTemp.splice(this.selectedDataTemp.indexOf(tag), 1);
			if(flag==1){
				this.$nextTick(() => {
					that.toggleSelection(tempSelectCurrent,"resourceTable");
				})
			}
						
		},
		searchSelectedList(){
	    	let param={
				dataGroupId:this.dataGroupRow.dataGroupId,
				resourceId:this.dataGroupRow.resourceId ,
			}
			let urlH="/dev-basp-system/dataGroup/hasParams"
			this.$httpExt().post(urlH, param)
			.then((response) => {
				let body = response.result
				this.selectedData =  body
				this.selectedDataTemp = this.$deepCopy( body,[]) 
				if(this.mainRow.paramStruct == 1){
					 this.paramStruct=this.mainRow.paramStruct
				}else{
					this.searchResourceList();
				}
			}, (response) => {
				this.wornForm={
					visibleWorn:true,
					title:'',
					type:'error',
					centerBtn:'我知道了',
					msg:response.msg? response.msg:'系统异常，请联系管理员！',
				}
			});
	    },
	    searchResourceList(init){ //数据组资源列表
	    	this.currentPageFlag=true
	    	this.loadind1=true;
			const that=this;
			let param={
				code:this.dataGroupRow.nodeCode,
				name:this.dataGroupRow.nodeName,
				parentCode:this.dataGroupRow.parentCode,
				dataGroupId:this.dataGroupRow.dataGroupId,
				resourceId:this.dataGroupRow.resourceId ,
				pageSize:this.pagination1.pageSize,
				pageNum:this.pagination1.pageNum,
				paramUrl:this.dataGroupRow.paramUrl || '',
				mark:this.dataGroupRow.isusable,
				netCode:this.dataGroupRow.paramType==6?this.dataGroupRow.netCode:null,
				orgIdSour:this.dataGroupRow.paramType==11?this.dataGroupRow.netCode:null,
			}
			let urlH="/dev-basp-system/resource/selectParams"
			if(this.paramStruct==1){  //树形的资源列表搜索
				urlH = '/dev-basp-system/resource/selectParamsList'
			}
			this.$httpExt().post(urlH, param)
			.then((response) => {
				this.loadind1=false;
				let body = response.result
				this.tableData = body.data
				this.pagination1.totalSize=body.totalSize
				let tempSelectCurrent=[]
				for(let i=0;i<that.tableData.length;i++){
					for(let k=0;k<that.selectedData.length;k++){
						let id1=that.selectedData[k].code
						let id2=that.tableData[i].code
						if(id1==id2){
							tempSelectCurrent.push(that.tableData[i]);
							break;
						}
					}
				}
				this.$nextTick(() => {
					that.toggleSelection(tempSelectCurrent,"resourceTable")
				});		
				this.multipleSelection1=tempSelectCurrent
			}, (response) => {
				this.currentPageFlag=false
				this.loadind1=false;
				Notification.error({
					title: this.$t('common.exception'),
					message: response.msg? response.msg:this.$t('common.exceptionWornText')
				});
			});
	    },
	    toggleSelection (rows, val) {
            if (rows.length) {
	          rows.forEach(row => {
	            this.$refs[val].toggleRowSelection(row)
	          })
	        } else {
	          this.$refs[val].clearSelection()
	        }
	        this.currentPageFlag=false
	    },
	    handleCurrentChangePage1(val){  //数据组主数据列表形式分页
	    	this.currentPageFlag=true
			this.pagination1.pageNum = val
			this.searchResourceList()
		},
		pageSizeChange1(val){//数据组主数据列表形式分页
			this.pagination1.pageNum = 1
			this.pagination1.pageSize = val
			this.searchResourceList()
		},
		saveAutoDefinedPerporty(arr){//显示可以勾选的字段配置
			this.selectTagArr=arr
		}
	}
}
</script>
<style lang="less">
.appendDataResource{
	.el-dialog{
		width:1100px;
	}
	.remark{
		font-size: 12px;
	    color: #909399;
	    line-height: inherit;
	    min-height: 40px;
	    margin-bottom: 22px;
	    margin-left: 4px;
	}
	.tapbar{
		width:86%;
		.change-item{
			width:50%;
			height:36px;
			background: #FFFFFF;
			border: 1px solid #DEE1E7;
			box-sizing: border-box;
		}
		.change-item:first-child{
			border-radius: 2px 0 0 0;
		}
		.change-item:last-child{
			border-left:0 !important;
			border-radius: 0 2px 0 0;
		}
		.change-item.active{
			background: #E6F1FC;
			border: 1px solid #A3D0FD;
			color:#1989FA;
		}
	}
	.border-box{
		border: 1px solid #DCDFE6;
		border-radius: 2px;
		box-sizing: border-box;
		height:436px;
		.tagList{
			overflow: auto;
			height:399px;
			color:#7d8392;
			.tagItem{
				position: relative;
				.code{
					margin-left:16px;
					width:140px;
					margin-right: 20px;
					height:32px;
					line-height: 32px;
				}
			}
			.el-tag__close{
				display:none;
				position: absolute;
				right:3px;
				border-radius: 50%;
			    text-align: center;
			    cursor: pointer;
			    font-size: 16px;
			    height: 18px;
			    width: 18px;
			    line-height: 18px;
			    vertical-align: middle;
			    color:#999;
			}
			.el-tag__close:hover{
    			color: #008CFF;
			}
			.text{
				width:230px;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				display: inline-block;
				height:32px;
				line-height: 32px;
				padding-right: 20px;
			}
		}
		.tagItem:hover .el-tag__close{
			display: block;
		}
		.tagItem:hover{
			background-color: #F2F9FF;
		}
		.el-table{
			color:#7d8392;
		}
		.el-table th{
			padding:6px 0;
			div{
				padding-right: 0;
			}
		}
		.el-table td{
			padding:6px 0;
			border-bottom: 0;
			div{
				padding-right: 0;
			}
		}
	}
	.border-box.left{
		width:540px;
		margin-right: 20px;
		overflow: auto;
	}
	.border-box.right{
		width:500px;
		.tips{
			height:36px;
			line-height: 36px;
			color:#7D8392;
			padding-left: 20px;
			border-bottom:1px solid #ECEEF3;
		}
	}
	.custom-tree-node.partlySelect{
		.custom_indeterminate{
			margin-left: -21px;
    		margin-right: 8px;
		}
	}
	.selectTags{
		border: 1px solid #efefef;
	    padding: 10px;
	    min-height: 54px;
	    max-height: 200px;
	    overflow-y: auto;
	    .desc{
	    	font-size: 12px;
    		color: #909399;
	    }
	    .el-tag{
	    	margin-right: 10px;
	    	margin-top: 10px;
	    }
	}
	.el-pagination{
		margin-top: 0;
	}
}
</style>
